<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>将当前会话数据编码为一个字符串</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.session-destroy.html">session_destroy</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.session-get-cookie-params.html">session_get_cookie_params</a></div>
 <div class="up"><a href="ref.session.html">Session 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.session-encode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">session_encode</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">session_encode</span> &mdash; <span class="dc-title">将当前会话数据编码为一个字符串</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.session-encode-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>session_encode</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>session_encode()</strong></span>
   返回一个序列化后的字符串，包含被编码的、储存于 $_SESSION 超全局变量中的当前会话数据。
  </p>
  <p class="para">
   请注意，序列方法 和 <span class="function"><a href="function.serialize.html" class="function">serialize()</a></span> 是不一样的。
   该序列方法是内置于 PHP 的，能够通过设置 <a href="session.configuration.html#ini.session.serialize-handler" class="link">session.serialize_handler</a> 来设置。
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.session-encode-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回当前会话编码后的内容。
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.session-encode-notes">
  <h3 class="title">注释</h3>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    在调用 <span class="function"><a href="function.session-decode.html" class="function">session_decode()</a></span> 之前必须先调用 <span class="function"><a href="function.session-start.html" class="function">session_start()</a></span>。
   </p>
  </div>
 </div>
 
 
 <div class="refsect1 seealso" id="refsect1-function.session-encode-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.session-decode.html" class="function" rel="rdfs-seeAlso">session_decode()</a> - Decodes session data from a session encoded string</span></li>
    <li class="member"><a href="session.configuration.html#ini.session.serialize-handler" class="link">session.serialize_handler</a></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.session-destroy.html">session_destroy</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.session-get-cookie-params.html">session_get_cookie_params</a></div>
 <div class="up"><a href="ref.session.html">Session 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
